<!DOCTYPE html>
<html>

<head>
  <meta http-equiv="Pragma" content="no-cache" />
  <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
  <meta http-equiv="Expires" content="0" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" charset="utf-8">

  <title>Download Astable</title>
  <link rel="shortcut icon" href="https://gitee.com/moluopro/res/raw/master/Apps/icons/Astable.png">
  <style>
    html,
    body {
      width: 100%;
      max-width: 100%;
      height: 100%;
      max-width: 100%;
      margin: 0;
      padding: 0;
      font-family: sans-serif;
    }

    .main {
      box-sizing: border-box;
      width: 100%;
      height: 100%;
      padding: 1em;
      position: relative;
      font-size: 12px;
      background: #F6F9FC;
    }

    .main .logo {
      width: 155px;
      height: 50px;
      background: url('https://gitee.com/moluopro/res/raw/master/Apps/icons/Astable.png') no-repeat;
      background-size: contain;
    }

    .main .slogan {
      margin: 1.5em 0;
      text-align: center;
      color: #515151;
      font-weight: lighter;
    }

    .main .tip {
      text-align: center;
      color: #b5b5b5;
    }

    .main .tip .emphasis {
      color: #dada3a;
      font-weight: 500;
      font-size: 1.5em;
      padding: 0 0.2em;
    }

    .main .phone-sample {
      min-width: 300px;
      min-height: 200px;
      width: 60%;
      height: 60%;
      margin: 0 auto;
      background: url('./assets/app_view.png') center center no-repeat;
      background-size: contain;
    }

    .main .bottom {
      padding: 0 1em;
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      text-align: center;
      color: #d3d338;
      font-size: 1.2em;
    }

    .main .bottom div {
      margin: 1em 0;
      display: none;
    }

    .main .bottom button {
      width: 100px;
      height: 50px;
      border: none;
      line-height: 1em;
      border-radius: 30px;
      background-color: #d3d338;
      font-size: 1em;
      color: white;
      transition: transform .2s;
    }

    button:hover {
      transform: scale(1.1);
    }

    .wxtip {
      background: rgba(0, 0, 0, 0.8);
      text-align: center;
      position: fixed;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      z-index: 998;
      display: none;
    }

    .wxtip-icon {
      width: 100px;
      height: 100px;
      background: url('./assets/weixin_tip.png') no-repeat;
      -webkit-background-size: contain;
      -moz-background-size: contain;
      -o-background-size: contain;
      background-size: contain;
      display: block;
      position: absolute;
      right: 20px;
      top: 20px;
    }

    .wxtip-txt {
      margin-top: 200px;
      color: #fff;
      font-size: 16px;
      line-height: 1.5;
    }
  </style>
</head>

<body>
  <div class="main">
    <div class="logo"></div>
    <h1 class="slogan">Download the app. Let's go !</h1>
    <p class="tip"><span class="emphasis">Astable</span> is available on MS Store / Play Store</p>
    <div class="phone-sample"></div>
    <div class="bottom">
      <div id="mobile">
        <button class="download" device-type="android" id="android">
          Android
        </button>&nbsp;&nbsp;&nbsp;&nbsp;
        <button class="download" device-type="ios" id="ios">
          IOS / iPad
        </button>
      </div>
      <div id="desktop">
        <button class="download" device-type="others" id="win">
          Windows
        </button>&nbsp;&nbsp;&nbsp;&nbsp;
        <button class="download" device-type="others" id="mac">
          MacOS
        </button>&nbsp;&nbsp;&nbsp;&nbsp;
        <button class="download" device-type="others" id="linux">
          Linux
        </button>
      </div>
      <br><br>
    </div>
    <div class="wxtip" id="cover">
      <span class="wxtip-icon"></span>
      <p class="wxtip-txt">请点击右上角<br />选择“在浏览器中打开”</p>
    </div>
  </div>
  <script>
    var u = navigator.userAgent,
      isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1,
      isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
      isIpad = (/ipad/i.test(u.toLowerCase())),
      isWechat = u.indexOf('MicroMessenger') > -1,
      urls = {
        "android": "https://gitee.com/abandoft/astableweb/releases/download/v1.5.3/Astable_1.5.3.apk",
        "win": "https://gitee.com/abandoft/astableweb/releases/download/v1.5.3/Astable_1.5.3.exe"
      }

    // check if Wechat or Wework
    if (isWechat) {
      document.getElementById("cover").style.display = "block"
    }

    var targetElement, targetURL

    if (isAndroid || isIOS || isIpad) {
      targetElement = document.getElementById("mobile")
    }
    else {
      targetElement = document.getElementById("desktop")
    }

    targetElement.style.display = "block"

    var button = document.getElementById("android");
    button.addEventListener('click', function () {
      window.open(urls["android"])
    })
    var button = document.getElementById("win");
    button.addEventListener('click', function () {
      window.open(urls["win"])
    })


//     var os = (function() {
//     var UserAgent = navigator.userAgent.toLowerCase();
//     return {
//         isIpad          : /ipad/.test(UserAgent),
//         isIphone        : /iphone os/.test(UserAgent),
//         isAndroid       : /android/.test(UserAgent),
//         isWindowsCe     : /windows ce/.test(UserAgent),
//         isWindowsMobile : /windows mobile/.test(UserAgent),
//         isWin2K         : /windows nt 5.0/.test(UserAgent),
//         isXP            : /windows nt 5.1/.test(UserAgent),
//         isVista         : /windows nt 6.0/.test(UserAgent),
//         isWin7          : /windows nt 6.1/.test(UserAgent),
//         isWin8          : /windows nt 6.2/.test(UserAgent),
//         isWin81         : /windows nt 6.3/.test(UserAgent),
//         isMac           : /mac os/.test(UserAgent)
//     };
// }());

  </script>
</body>

</html>